﻿
IF object_id(N'dbo.[UDS_Staff]', 'U') IS NULL
BEGIN
    CREATE TABLE [dbo].[UDS_Staff] (
        [Staff_ID]     int           NOT NULL identity(1, 1),
        [Staff_Name]   nvarchar(50)  COLLATE Chinese_PRC_CI_AS NOT NULL,
        [Password]     nvarchar(255) COLLATE Chinese_PRC_CI_AS NULL,
        [RealName]     nvarchar(50)  COLLATE Chinese_PRC_CI_AS NULL,
        [Sex]          bit           NULL,
        [Email]        nvarchar(500) COLLATE Chinese_PRC_CI_AS NULL,
        [Status]       nvarchar(50)  COLLATE Chinese_PRC_CI_AS NULL,
        [RegistedDate] datetime      NULL,
        [Dimission]    bit           NULL CONSTRAINT [DF_UDS_Staff_Dimission] default(0),
        [Phone]        nvarchar(50)  COLLATE Chinese_PRC_CI_AS NULL,
        [Mobile]       nvarchar(50)  COLLATE Chinese_PRC_CI_AS NULL,
        [Birthday]     datetime      NULL,
        [Style]        int           NULL CONSTRAINT [DF_UDS_Staff_Style] default(0),
        [IsNeedKey]    bit           NULL CONSTRAINT [DF_UDS_Staff_IsNeedKey] default(0),
        [Caste]        int           NULL CONSTRAINT [DF_UDS_Staff_Caste] default(0),

        CONSTRAINT [PK_UDS_Staff] PRIMARY KEY CLUSTERED ([Staff_ID] asc)
    );
    CREATE UNIQUE NONCLUSTERED INDEX [IX_UDS_Staff_Staff_Name] ON dbo.UDS_Staff (Staff_Name asc);
END
GO

SET NOCOUNT ON;
IF NOT EXISTS (SELECT 1 FROM dbo.[UDS_Staff])
BEGIN
    SET IDENTITY_INSERT dbo.UDS_Staff ON;
    INSERT INTO dbo.UDS_Staff ( Staff_ID, Staff_Name, [Password], RealName ) VALUES ( 1, N'admin', N'admin', N'管理员' );
    SET IDENTITY_INSERT dbo.UDS_Staff OFF;
END
GO